/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "common/common.h"
#include "dialog_model.h"

namespace ArkUICapiTest {

static napi_value DialogModelTest_001(napi_env env, napi_callback_info info)
{
    ArkUI_DialogDismissEvent* nEvent = new ArkUI_DialogDismissEvent({ nullptr, 0, false });
    nEvent = nullptr;
    OH_ArkUI_DialogDismissEvent_SetShouldBlockDismiss(nEvent, true);
    ASSERT_EQ(nEvent == nullptr, true);
    NAPI_END;
}
static napi_value DialogModelTest_002(napi_env env, napi_callback_info info)
{
    ArkUI_DialogDismissEvent* nEvent = new ArkUI_DialogDismissEvent({ nullptr, 0, false });
    void* ret = OH_ArkUI_DialogDismissEvent_GetUserData(nEvent);
    nEvent = nullptr;
    ret = OH_ArkUI_DialogDismissEvent_GetUserData(nEvent);
    ASSERT_EQ(ret == nullptr, true);
    NAPI_END;
}
static napi_value DialogModelTest_003(napi_env env, napi_callback_info info)
{
    ArkUI_DialogDismissEvent* nEvent = new ArkUI_DialogDismissEvent({ nullptr, 0, false });
    int32_t ret = OH_ArkUI_DialogDismissEvent_GetDismissReason(nEvent);
    ASSERT_EQ(ret, nEvent->reason);
    nEvent = nullptr;
    ret = OH_ArkUI_DialogDismissEvent_GetDismissReason(nEvent);
    ASSERT_EQ(ret, -1);
    NAPI_END;
}


} // namespace ArkUICapiTest

